//
//  YYEPersonalTableViewCell.m
//  YuYingEDU
//
//  Created by 胡波 on 2017/12/30.
//  Copyright © 2017年 胡波. All rights reserved.
//

#import "YYEPersonalTableViewCell.h"

@interface YYEPersonalTableViewCell ()

@property (nonatomic,strong) UIImageView *rightIV;

@end

@implementation YYEPersonalTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.contentView.backgroundColor = GeneralBackColor;
        self.backIV = [[UIImageView alloc]init];
        [self.contentView addSubview:self.backIV];
        
        self.nameLabel = [[UILabel alloc] init];
        self.nameLabel.font = [UIFont systemFontOfSize:14];
        self.nameLabel.textColor = [UIColor blackColor];
        [self.backIV addSubview:self.nameLabel];
        
        _redDot = [[UILabel alloc] init];

        _redDot.font = [UIFont systemFontOfSize:12];
        _redDot.textAlignment = NSTextAlignmentCenter;
        _redDot.textColor = [UIColor whiteColor];
        _redDot.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_redDot];
        
        self.rightIV = [[UIImageView alloc]init];
        [self.backIV addSubview:self.rightIV];
        
        self.lineView = [[UIView alloc]init];
        self.lineView.backgroundColor = GeneralBackColor;
        [self.backIV addSubview:self.lineView];
        
        self.rightIV.image = [UIImage imageNamed:@"right"];
        self.nameLabel.text = @"课程收藏";
        
        
        
    }
    return self;
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    [self.backIV makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.left).offset(10);
        make.right.equalTo(self.contentView.right).offset(-10);
        make.top.equalTo(self.contentView.top);
        make.bottom.equalTo(self.contentView.bottom).offset(-0.5);
    }];
    
    [self.nameLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.backIV.left).offset(10);
        make.centerY.equalTo(self.backIV.centerY);
    }];
    
    [self.redDot makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel.right);
        make.centerY.equalTo(self.backIV.centerY).offset(-9);
        make.size.equalTo(CGSizeMake(18, 18));

    }];
    _redDot.layer.cornerRadius = 9;
    _redDot.layer.masksToBounds = YES;
    
    [self.rightIV makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.backIV.right).offset(-10);
        make.centerY.equalTo(self.backIV.centerY);
        make.size.equalTo(CGSizeMake(8, 13));
    }];
    
    [self.lineView makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self.backIV);
        make.height.equalTo(0.5);
    }];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
